• Add a While Loop to your program. Delete the two default commands inside the while loop.
  • Change the variable above the loop to code. Change the value to an empty list with two square [ ] brackets.
  • Have the loop run while the len() (length) of code is less than < 4.
  • Drag Random Choice inside the loop. Name it next_col and change the list parameter to colors.
  • if next_col is not in the code list, Append the value of next_col to the list code.
  • Outside of the loop, add a Wait command so the stage pauses for 1 second.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)